// 创建和加入房间
class addRoom extends eui.Component{
    private btn1:eui.Image;
    private btn2:eui.Image;
    private tx:eui.Label;
    public ON_CLICK:string = "onClick";

    public constructor(){
        super();
        this.once(eui.UIEvent.COMPLETE,this.onComplete,this);
        this.skinName = "src/Game/gameRoom/DIYBtn/addRoomSkin.exml";
    }
    private onComplete(){
        this.tx.type = egret.TextFieldType.INPUT;
        this.once(egret.Event.REMOVED_FROM_STAGE,this.onRemove,this); 
        this.btn1.addEventListener(egret.TouchEvent.TOUCH_TAP,this.onNew,this);
        this.btn2.addEventListener(egret.TouchEvent.TOUCH_TAP,this.onAdd,this);     
    }
    private onAdd(e:egret.TouchEvent){
        this.dispatchEventWith(this.ON_CLICK,false,this.tx.text);
    }
    private onNew(e:egret.TouchEvent){
        this.dispatchEventWith(this.ON_CLICK,false,"");
    }
    private onRemove(){
        this.btn1.removeEventListener(egret.TouchEvent.TOUCH_TAP,this.onNew,this);
        this.btn2.removeEventListener(egret.TouchEvent.TOUCH_TAP,this.onAdd,this);
    }    
}